/*
 * @Author: 肖思汗 
 * @Date: 2025-06-20 11:18:04 
 * @Last Modified by: 肖思汗
 * @Last Modified time: 2025-07-21 14:25:37
 */
import { autorun } from "mobx";
import { ReactNode, useEffect, useRef, useState } from "react";
import styles from "./clause.module.less";
import { RichText } from "@tarojs/components";
import utilsApi from "src/api/utilsApi";
import PageLayer from "src/components/PageLayer/PageLayer";

interface Iprops {
    children?: ReactNode
}

// 条款
export default function Clause() {

    const [richText, setRichText] = useState("");

    useEffect(() => {
        utilsApi.queryPropertyByTitle("clause").then((richText) => {
            setRichText(richText);
        });
    }, []);

    useEffect(() => autorun(() => {
    }, { delay: 30 }), []);

    return (
        <PageLayer
            showBack={true}
            title="服务条款"
            className={styles.clause}
            hasTabBar={false}
        >
            {/* <div ref={dom} className={styles.clause} > */}
            <RichText
                className="ql-editor"
                nodes={richText.replace(/<img([^>]*)>/g, '<img style="max-width:100%;height:auto;" $1>')}
            />
            {/* </div> */}
        </PageLayer>
    );
}